FROM python:3.9-buster

# RUN echo "deb https://mirrors.aliyun.com/debian/ buster main contrib non-free" > /etc/apt/sources.list && \
#     echo "deb https://mirrors.aliyun.com/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list && \
#     echo "deb https://mirrors.aliyun.com/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list && \
#     echo "deb https://mirrors.aliyun.com/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list

RUN apt-get update -y && apt-get install -y curl

RUN apt-get install -y \
      git gcc wget gzip busybox sudo

RUN busybox --install /bin
RUN chsh -s bash

RUN useradd user && echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user
RUN mkdir /home/user
RUN chown user /home/user
WORKDIR /soft

RUN wget "https://github.com/coder/code-server/releases/download/v4.0.0/code-server-4.0.0-linux-amd64.tar.gz" &&  \
    tar -xvzf code-server-4.0.0-linux-amd64.tar.gz && \
    chmod 777 ./code-server-4.0.0-linux-amd64/bin/code-server && mkdir -p /.config/code-server && chmod 777 -R /.config
RUN chmod 777 -R /bin /tmp /usr /var

ENV CODE_SERVER_PORT=8443
ENV PASSWORD=lijiacai

CMD bash -c "/soft/code-server-4.0.0-linux-amd64/bin/code-server --port $CODE_SERVER_PORT --host 0.0.0.0 /data"